#version 320 es
#ifdef GL_ES
	precision highp float;
#endif
in vec3 iVertex;

uniform mat4 uMVP;

out float posY;

uniform float fadeEndZ;
out float fadeEndZFragCoordY;

struct View3D {
	float ssaa;
	mediump int w;
	mediump int h;
	mediump int skylineFromTopPx;
	mediump int fadeOffsetSkylinePx;
	mediump int fadeOffsetHorizonPx;
};
uniform View3D view3d;

void main()
{
	vec4 clipPos =  uMVP * vec4(0.0f, 0.0f, fadeEndZ, 1.0f);
	vec3 ndc = clipPos.xyz / clipPos.w;
	fadeEndZFragCoordY = float(ndc.y * 0.5 + 0.5) * float(view3d.h);

	posY = iVertex.y;
	gl_Position =  uMVP * vec4(iVertex, 1.0);
}